<template>

  <div>
    <section>
      <!--工具条-->
      <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
        <el-form :inline="true" >
          <el-form-item>
            <el-input  placeholder="权限名称" v-model="keyWorld"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="searchPermission">查询</el-button>
          </el-form-item>

        </el-form>
      </el-col>

      <!--列表-->
      <el-table :data="permissionList" highlight-current-row v-loading="loading" style="width: 100%;" >
        <el-table-column
            type="selection">
        </el-table-column>

        <el-table-column prop="id" label="权限id" >
        </el-table-column>

        <el-table-column prop="name" label="权限名称" >
        </el-table-column>

        <el-table-column prop="url" label="权限url" >
        </el-table-column>


        <el-table-column prop="sn" label="权限sn" >
        </el-table-column>


        <el-table-column prop="parentName" label="父权限" >

        </el-table-column>



      </el-table>
<!--      分页插件-->
      <el-pagination
          background
          layout="total, sizes, prev, pager, next"
          :current-page="1"
          @current-change="currentPageChange"
          @size-change="sizePageChange"
          :page-size.sync="size"
          :page-sizes="[5,6,7,8]"
          :total="total">
      </el-pagination>
    </section>
  </div>

</template>
<script>
import axios from "axios";

export default {
  name: "permission",
  data(){
    return {
      pages:[5,6,7,8],
      total:0,
      page:1,
      size:5,
      keyWorld:'',
      permissionList:[],
      loading:true,
    }
  },
  methods:{
    //根据权限名称查找权限信息
    searchPermission(){

    },
    currentPageChange(val){
      this.page=val;
      this.loadDingData();
    },
    sizePageChange(val){
      this.size=val;
      this.loadDingData();
    },
    loadDingData(){
      axios({
        url:'/permission/findList?page='+this.page+"&size="+this.size,
        method:'get'
      }).then(resp=>{
        if (resp.data.code==200){
          this.$message({
            message:resp.data.msg,
            type:'success'
          })
          this.loading=false;
          this.permissionList=resp.data.data;
          this.total=resp.data.total;
        }
      })
    }
  },
  mounted() {
    //加载所有权限列表
    this.loadDingData();
  }
}
</script>

<style scoped>

</style>